[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
-loctnum
enables automatic line-ending processing. It has two
effects: first, it automatically chops the line termi-
nator when used with -n or -p , and second, it assigns
$\ to have the value of octnum so that any print state-
ments will have that line terminator added back on. If
octnum is omitted, sets $\ to the current value of $/.
For instance, to trim lines to 80 columns:
perl -lpe 'substr($_, 80) = ""'
Note that the assignment $\ = $/ is done when the
switch is processed, so the input record separator can
be different than the output record separator if the -l
switch is followed by a -0 switch:
gnufind / -print0 | perl -ln0e 'print "found $_" if -p'
This sets $\ to newline and then sets $/ to the null
character.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson